package com.yc.chaoshi.cs_manage.mapper;

import com.yc.chaoshi.entity.PmsBrand;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author xz
 * @since 2022-08-04
 */
public interface PmsBrandMapper extends BaseMapper<PmsBrand> {

    List<PmsBrand> selectbrand(@Param("pname")String aname,
                                   @Param("page")int page,
                                   @Param("size") int size);

    @Delete("delete from pms_brand where pid=#{pid}")
    Long deleteBrand(@Param("pid") int pid);

    //update pms_brand set bid=null,pname='可比克',pmsg=null,display=1 where pid=187
    //insert into pms_brand values(default,18,'咳咳',null,1)
    @Insert("insert into pms_brand values(default,null,#{pname},#{pmsg},#{display})")
    Long insertBrand(@Param("pname") String pname,
                     @Param("pmsg") String pmsg,
                     @Param("display") int display);

    @Update("update pms_brand set bid=null,pname=#{pname},pmsg=#{pmsg},display=#{display} where pid=#{pid}")
    Long updateBrand(@Param("pname") String pname,
                     @Param("pmsg") String pmsg,
                     @Param("display") int display,
                     @Param("pid") int pid
    );
}
